package com.gitlab.bootren.data.core.jpa.entity;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

/**
 * Created by serv on 2015/6/29.
 */
@MappedSuperclass
public abstract class BaseNameEntity extends BaseEntity {

    /**
     * 名称
     */
    @Column(name = "NAME", length = 255 ,nullable = false)
    protected String name;


    /**
     * 拼音
     */
    @Column(name = "SPELL", length = 255)
    protected String spell;

    /**
     * 简拼
     */
    @Column(name = "SHORT_SPELL", length = 255)
    protected String shortSpell;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        this.setSpell(PinyinUtils.getPinYin(name));
        this.setShortSpell(PinyinUtils.getPinYinHeadChar(name));
    }

    public String getSpell() {
        return spell;
    }

    public void setSpell(String spell) {
        this.spell = spell;
    }

    public String getShortSpell() {
        return shortSpell;
    }

    public void setShortSpell(String shortSpell) {
        this.shortSpell = shortSpell;
    }

}
